"""mxoling URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,re_path
from django.conf.urls import url, include
from django.views.generic import TemplateView
from django.views.static import serve
from mxoling.settings import MEDIA_ROOT


import xadmin

from apps.users.views import LoginView, RegisterView, LogoutView, ActiveView, ForgetPwdView, ResetView, ModifyPwdView,IndexView
from apps.organizations.views import OrgView

urlpatterns = [
    # path('admin/', admin.site.urls),
    # 后台
    path('xadmin/', xadmin.site.urls),
    # 首页
    path("", IndexView.as_view(), name='index'),
    # 登录
    path("login/", LoginView.as_view(), name='login'),
    # 登出
    path("logout/", LogoutView.as_view(), name='logout'),
    # 注册
    path("register/", RegisterView.as_view(), name='register'),
    # 忘记密码
    url('^forget/$', ForgetPwdView.as_view(), name='forget_pwd'),
    # 重置密码时发送的邮箱链接
    url(r'^reset/(?P<active_code>.*)/$', ResetView.as_view(), name="reset_pwd"),
    # 重置密码
    url('^modify_pwd/$', ModifyPwdView.as_view(), name='modify_pwd'),
    # 图形验证码
    url(r'^captcha/', include('captcha.urls')),
    # 激活链接
    url('^active/(?P<active_code>.*)/$', ActiveView.as_view(), name='active_code'),
    # 配置上传文件url
    url('^media/(?P<path>.*)$', serve, {"document_root":MEDIA_ROOT}),
    # url('^static/(?P<path>.*)$', serve, {"document_root":STATIC_ROOT}),
    # 机构页面
    url(r'^org/', include(('apps.organizations.urls','organizations'),namespace='org')),
    # 用户相关操作
    url(r'^op/', include(('apps.operation.urls','operation'),namespace='op')),
    # 课程相关界面
    url(r'^course/', include(('apps.courses.urls','courses'),namespace='course')),
    # 讲师相关界面
    url(r'^teacher/', include(('apps.courses.url_teacher','teacher'),namespace='teacher')),
    # 个人中心
    url(r'^center/', include(('apps.users.urls','center'),namespace='center')),
]
